package com.aspose.cells.a.d;

import com.aspose.cells.Color;

public class zgc {
   public static void a(com.aspose.cells.zal var0, zge var1, com.aspose.cells.b.a.b.zc var2) throws Exception {
      if (var2 != null) {
         if (var2 instanceof com.aspose.cells.b.a.b.zu) {
            a(var0, (com.aspose.cells.b.a.b.zu)var2);
         } else if (var2 instanceof com.aspose.cells.b.a.b.zx) {
            com.aspose.cells.b.a.b.zx var3 = (com.aspose.cells.b.a.b.zx)com.aspose.cells.b.a.zl.a(var2, com.aspose.cells.b.a.b.zx.class);
            a(var0, var1, var3);
         } else if (var2 instanceof com.aspose.cells.b.a.b.a.zg) {
            b(var0, var1, (com.aspose.cells.b.a.b.a.zg)var2);
         } else if (var2 instanceof zg) {
            zg var5 = (zg)var2;
            com.aspose.cells.b.a.b.a.zh var4 = new com.aspose.cells.b.a.b.a.zh(var5.d(), var5.c(), var5.b(), var5.a());
            a(var0, var4);
         }

      }
   }

   public static void a(com.aspose.cells.zal var0, zge var1, byte[] var2, com.aspose.cells.b.a.b.zq var3, int var4, com.aspose.cells.b.a.b.a.zi var5) throws Exception {
      zgj var6 = var1.a(var2);
      var0.b("ImageBrush");
      var0.c("ImageSource", var6.a());
      zbm var7 = var6.b();
      String var8 = com.aspose.cells.b.a.zv.a("{0},{1},{2},{3}", 0, 0, zgf.b(var7.f()), zgf.b(var7.g()));
      var0.c("Viewbox", var8);
      String var9 = com.aspose.cells.b.a.zv.a("{0},{1},{2},{3}", com.aspose.cells.a.c.zp.b(var3.f()), com.aspose.cells.a.c.zp.b(var3.g()), com.aspose.cells.a.c.zp.b(var3.h() > 0.0F ? var3.h() : (float)var7.f()), com.aspose.cells.a.c.zp.b(var3.i() > 0.0F ? var3.i() : (float)var7.g()));
      var0.c("Viewport", var9);
      var0.c("ViewboxUnits", "Absolute");
      var0.c("ViewportUnits", "Absolute");
      if (var5 != null) {
         var0.c("Transform", zgf.a(var5.b()));
      }

      var0.c("TileMode", zgf.d(var4));
      var0.c();
   }

   private static void a(com.aspose.cells.zal var0, com.aspose.cells.b.a.b.zu var1) throws Exception {
      var0.b("SolidColorBrush");
      var0.c("Color", zgf.a(var1.a()));
      var0.c();
   }

   private static void a(com.aspose.cells.zal var0, com.aspose.cells.b.a.b.a.zh var1) throws Exception {
      var0.b("LinearGradientBrush");
      var0.c("MappingMode", "Absolute");
      var0.c("StartPoint", com.aspose.cells.b.a.zv.a("{0},{1}", com.aspose.cells.a.c.zp.b(var1.o().f()), com.aspose.cells.a.c.zp.b(var1.o().g())));
      var0.c("EndPoint", com.aspose.cells.b.a.zv.a("{0},{1}", com.aspose.cells.a.c.zp.b(var1.o().l()), com.aspose.cells.a.c.zp.b(var1.o().k())));
      var0.c("SpreadMethod", "Repeat");
      if (var1.n() != null) {
         var0.c("Transform", zgf.a(var1.n()));
      } else {
         var0.c("Transform", zgf.a(new com.aspose.cells.b.a.b.a.zi()));
      }

      var0.b("LinearGradientBrush.GradientStops");
      if (var1.p() != null) {
         for(int var2 = 0; var2 < var1.p().length; ++var2) {
            a(var0, var1.p()[var2], (float)var2);
         }
      }

      var0.c();
      var0.c();
   }

   private static void a(com.aspose.cells.zal var0, Color var1, float var2) throws Exception {
      var0.b("GradientStop");
      var0.c("Color", zgf.a(var1));
      var0.c("Offset", com.aspose.cells.a.c.zp.b(var2));
      var0.c();
   }

   private static void b(com.aspose.cells.zal var0, zge var1, com.aspose.cells.b.a.b.zc var2) throws Exception {
      byte[] var3 = zbb.a((com.aspose.cells.b.a.b.a.zg)var2);
      a(var0, var1, var3, com.aspose.cells.b.a.b.zq.c(), 0, (com.aspose.cells.b.a.b.a.zi)null);
   }

   private static void a(com.aspose.cells.zal var0, zge var1, com.aspose.cells.b.a.b.zx var2) throws Exception {
      com.aspose.cells.a.c.zd var3 = new com.aspose.cells.a.c.zd(var2);

      try {
         byte[] var4 = zgk.a(var3);

         try {
            zbm var5 = zbn.b(var4);
            com.aspose.cells.b.a.b.zq var6 = new com.aspose.cells.b.a.b.zq(0.0F, 0.0F, (float)var5.b(), (float)var5.c());
            a(var0, var1, var4, var6, var2.c(), var2.b().b());
         } catch (Exception var10) {
            ;
         }
      } finally {
         if (var3 != null) {
            var3.a();
         }

      }

   }
}
